define(function(require, exports, module) {

  // var Backbone = require('backbone');
  var $ = require('jquery');
  var _ = require('lodash');
  // var jsonview = require('jsonview');
  var tmpl = require('text!../tmpl.html');

  function objectCreateOperator(obj, props) {
    var newObj = {};
    Object.defineProperties(newObj, props);
    newObj.__proto__ = obj;
    return newObj;
  }

  function app() {
    var anotherObject = {
      name: "DAFA"
    }

    var myObject = Object.create(anotherObject, {
      age: {
        value: 30
      }
    })

    window.anotherObject = anotherObject;
    window.myObject = myObject;

    console.log(Object.getPrototypeOf(anotherObject) === Object.prototype)
    console.log(Object.getPrototypeOf(myObject))
    console.log(myObject.name)
    console.log(myObject.age)
    console.log(myObject.hasOwnProperty('name'))
    console.log(myObject.hasOwnProperty('age'))
    console.log(myObject.propertyIsEnumerable("name"))
    console.log(myObject.propertyIsEnumerable("age"))

    var myObject2 = objectCreateOperator(anotherObject, {
      age: {
        value: 30
      }
    })

    window.myObject2 = myObject2;
    console.log(Object.getPrototypeOf(myObject2))
    console.log(myObject2.name)
    console.log(myObject2.age)
    console.log(myObject2.hasOwnProperty('name'))
    console.log(myObject2.hasOwnProperty('age'))
    console.log(myObject2.propertyIsEnumerable("name"))
    console.log(myObject2.propertyIsEnumerable("age"))
  }

  function main() {
    var $app = $('<div id="app">');
    $('#main').html($app);

    app();
    $app.append(tmpl);
  }

  return main;
})
